<?php
/**
 * News model
 * 
 * @author Konstantin Shamko <konstantin.shamko@gmail.com> 
 * @version 0.0.1
 * @copyright  Copyright (c) 2009 Konstantin Shamko
 * @package News Module
 * @subpackage Model
 * @license  New BSD License
 *
 */
class Models_News extends Bel_Model_Abstract {
	/**
	 * News table name
	 *
	 * @var string
	 */
	protected $_name;
	
	/**
	 * News table primary key
	 *
	 * @var array
	 */
	protected $_primary = array ('news_id' );
	
	/**
	 * Initialization. Sets news table name 
	 *
	 */
	public function __construct() {
		$this->_name = TABLE_PREFIX . "news";
		parent::__construct ();
	}
	
	/**
	 * Returns all news ordered buy date and ID
	 *
	 * @param integer $page - page for paging
	 * @return array - array with stdObjects
	 */
	public function getAllNews($page = null) {
		return parent::getAll ( null, array('news_date DESC', 'news_id DESC'), $page);
	}	
}
